// -----------------------------------------------------------------------
//  <copyright file="IIntegrationEventBus.cs" company="LiuliuSoft">
//      Copyright (c) 2022-2024 DaprPlus. All rights reserved.
//  </copyright>
//  <site>https://dapr.plus</site>
//  <last-editor>郭明锋</last-editor>
//  <last-date>2024/12/12 22:59</last-date>
// -----------------------------------------------------------------------

namespace DaprPlus.Domain.Events;

/// <summary>
/// 定义集成事件总线
/// </summary>
public interface IIntegrationEventBus
{
    /// <summary>
    /// 发布指定服务间强类型集成事件
    /// </summary>
    /// <typeparam name="TIntegrationEvent">集成事件强类型</typeparam>
    /// <param name="event">集成事件</param>
    /// <param name="token"></param>
    /// <returns></returns>
    Task PublishAsync<TIntegrationEvent>(TIntegrationEvent @event, CancellationToken token = default)
        where TIntegrationEvent : IntegrationEvent;

    /// <summary>
    /// 发布指定服务间集成事件
    /// </summary>
    /// <param name="event">基类表示的集成事件</param>
    /// <param name="token"></param>
    /// <returns></returns>
    Task PublishAsync(IntegrationEvent @event, CancellationToken token = default);
}
